<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css-wap/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css-wap/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css-wap/style.css">
    <script src="__STATIC__/js-wap/jquery-1.11.3.min.js"></script>
    <script src="__STATIC__/js-wap/swiper.min.js"></script>
    <script src="__STATIC__/js-wap/common.js"></script>
    <title>我的兑奖记录</title>

</head>
<body>
<div class="wrap">
    <div class="header-main">
        <a href="{:url('mobile/draw/order_list',['status'=>0])}"><img src="__STATIC__/img-wap/back.png" class="back"></a>
        <span class="title">我的兑奖记录</span>
    </div>
    <div class="center-det">
        {if condition="$address"}
        <div class="address">
            <span>收货人</span>
            <p>{$address.name}    {$address.phone}<span><a href="#"><img src="__STATIC__/img-wap/more1.png" class="more"></a></span></p>
            <p>{$address.area_info} {$address.address}</p>
        </div>
        {else/}
        <div class="address">
            <a href="javascript:change_address();">
                <p style="text-align: center;color: #212121;"><img style="vertical-align: middle;" src="__STATIC__/img_user/go_jump.png" />去选择收货地址</p>
            </a>
        </div>
        {/if}
    </div>
    <div class="order-main">
        <div class="content">
            <a href="#">
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <img class="media-object" src="__STATIC__/img-wap/pic22.png" alt="">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading">{$item.title}</h4>
                    </div>
                </div>
            </a>
        </div>
    </div>
    <input type="hidden" id="address_id" value="{$address.id}">
    <div class="footer-submit fix">
        <input type="submit" value="确认兑换" onclick="confirmation({$item['id']});">
    </div>

</div>
</body>
{include file="public/src" /}
<script>

    //修改地址
    function change_address(){
        sessionStorage.setItem('order_yes_url',window.location.href);
        window.location.href = "{:url('mobile/user_info/address_manage')}?act=auction";
    }
    
    
    // 确认兑换积分商品
    function confirmation(id) {
        $.ajax({
            url :"{:url('mobile/draw/generating_order')}",
            data:{
                'address_id' : $('#address_id').val(),
                'order_id':id,
            },
            type:'post',
            dataType :'json',
            success : function (data) {

                if (data.code == 200){
                    layer.open({content:data.message,skin:'msg',time:2});
                    setTimeout(function () {
                        window.location.href = "{:url('mobile/draw/order_list')}"
                    },2000)
                }

            },
            error: function () {
                layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
            }
        })
    }




</script>
</html>